const http = require('http');
var sv = http.createServer();

sv.on('request', (req, res)=>{
    // res.statusCode = 404;
    // res.statusMessage = 'not found';
    res .setHeader('Content-Type', 'text/plain;charset=utf-8');

    // res.writeHead(404, 'not found', {
    //     'Content-Type':'text/plain;charset=utf-8'
    // });

    res.write('这是服务器端的响应报文。');

    res.end();

    res.statusCode = 200;
    res.write('写在end之后的内容。');
});

sv.listen(8088,()=>{console.log('服务器已启动，端口号：8088')});